import { View, Text, Button } from "@tarojs/components";
import Taro, { useLoad } from "@tarojs/taro";
import "./index.scss";

export default function Index() {
  useLoad(() => {
    console.log("Page loaded.");
  });

  function goBack() {
    Taro.navigateBack({
      delta: 1,
    });

    // 触发一个全局事件
    Taro.eventCenter.trigger("acceptDataFormDatail03Page", {
      data: "将detail03的数据传递到home页面",
    });
  }

  return (
    <View className="index">
      <Text>Hello world! detail03</Text>
      <Button onClick={goBack}>返回</Button>
    </View>
  );
}
